package com.uidt.project.ptsj.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.uidt.framework.aspectj.lang.annotation.Log;
import com.uidt.framework.aspectj.lang.enums.BusinessType;
import com.uidt.project.ptsj.domain.PtsjScreenPlaceRoomNum;
import com.uidt.project.ptsj.service.IPtsjScreenPlaceRoomNumService;
import com.uidt.framework.web.controller.BaseController;
import com.uidt.framework.web.domain.AjaxResult;
import com.uidt.common.utils.poi.ExcelUtil;
import com.uidt.framework.web.page.TableDataInfo;

/**
 * 大屏场所和房源数Controller
 * 
 * @author uidt
 * @date 2024-10-23
 */
@RestController
@RequestMapping("/ptsj/num")
public class PtsjScreenPlaceRoomNumController extends BaseController
{
    @Autowired
    private IPtsjScreenPlaceRoomNumService ptsjScreenPlaceRoomNumService;

    /**
     * 查询大屏场所和房源数列表
     */
    @PreAuthorize("@ss.hasPermi('ptsj:num:list')")
    @GetMapping("/list")
    public TableDataInfo list(PtsjScreenPlaceRoomNum ptsjScreenPlaceRoomNum)
    {
        startPage();
        List<PtsjScreenPlaceRoomNum> list = ptsjScreenPlaceRoomNumService.selectPtsjScreenPlaceRoomNumList(ptsjScreenPlaceRoomNum);
        return getDataTable(list);
    }

    /**
     * 导出大屏场所和房源数列表
     */
    @PreAuthorize("@ss.hasPermi('ptsj:num:export')")
    @Log(title = "大屏场所和房源数", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PtsjScreenPlaceRoomNum ptsjScreenPlaceRoomNum)
    {
        List<PtsjScreenPlaceRoomNum> list = ptsjScreenPlaceRoomNumService.selectPtsjScreenPlaceRoomNumList(ptsjScreenPlaceRoomNum);
        ExcelUtil<PtsjScreenPlaceRoomNum> util = new ExcelUtil<PtsjScreenPlaceRoomNum>(PtsjScreenPlaceRoomNum.class);
        util.exportExcel(response, list, "大屏场所和房源数数据");
    }

    /**
     * 获取大屏场所和房源数详细信息
     */
    @PreAuthorize("@ss.hasPermi('ptsj:num:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(ptsjScreenPlaceRoomNumService.selectPtsjScreenPlaceRoomNumById(id));
    }

    /**
     * 新增大屏场所和房源数
     */
    @PreAuthorize("@ss.hasPermi('ptsj:num:add')")
    @Log(title = "大屏场所和房源数", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PtsjScreenPlaceRoomNum ptsjScreenPlaceRoomNum)
    {
        return toAjax(ptsjScreenPlaceRoomNumService.insertPtsjScreenPlaceRoomNum(ptsjScreenPlaceRoomNum));
    }

    /**
     * 修改大屏场所和房源数
     */
    @PreAuthorize("@ss.hasPermi('ptsj:num:edit')")
    @Log(title = "大屏场所和房源数", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PtsjScreenPlaceRoomNum ptsjScreenPlaceRoomNum)
    {
        return toAjax(ptsjScreenPlaceRoomNumService.updatePtsjScreenPlaceRoomNum(ptsjScreenPlaceRoomNum));
    }

    /**
     * 删除大屏场所和房源数
     */
    @PreAuthorize("@ss.hasPermi('ptsj:num:remove')")
    @Log(title = "大屏场所和房源数", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(ptsjScreenPlaceRoomNumService.deletePtsjScreenPlaceRoomNumByIds(ids));
    }
}
